package org.cnbi.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.cnbi.entity.Menu;
import org.cnbi.service.IHandleService;
import org.cnbi.utils.pojo.SqlParamsBean;
import org.cnbi.utils.tools.ActionConstants;
import org.cnbi.utils.tools.MenuConstants;
import org.cnbi.web.controller.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.servlet.view.RedirectView;

/**
 * 系统请求页面的核心控制器 凡是是请求页面的动作，都到这里来写吧！ 
 * Copyright © 2014中国经邦. All rights reserved.
 * @author 龚佳新
 * @date 2014年4月17日下午12:47:04
 * @cnbi-web
 */
@Controller
@RequestMapping("/manage")
public class ManageController extends BaseController {
	@Autowired
	private IHandleService handleService;
	
	@RequestMapping(value = "/index")
	public ModelAndView main(HttpServletResponse response) {
		ModelAndView view = firstNavHandle(ActionConstants.MANAGE,response);
		manage(view);
		return view;
	}
	public void manage(ModelAndView view) {
		List<Menu> list = new ArrayList<Menu>();
		list.add(new Menu("userM","用户管理","manage","可对用户进行增删改查等操作,还可查看在线用户"));
		list.add(new Menu("dataM","数据管理","manage","可对数据进行增删改查等操作,亦实现U8,KS数据接口导入"));
		list.add(new Menu("rightM","权限管理","manage","可对用户进行菜单，角色，其它功能进行授权操作"));
		list.add(new Menu("tableM","报表管理","manage","目前应用了财务的3张主表，可操作哦"));
		list.add(new Menu("reportM","报告管理","manage","按公司，期间维度分的报告"));
		list.add(new Menu("dashM","模型管理","manage","目前应用了财务主表预测模型"));
		list.add(new Menu("newsM","新闻管理","manage","目前应用了财务主表预测模型"));
		list.add(new Menu("sysM","系统设置","manage","对系统相关参数进行设置"));
		view.addObject("listDatas", list);
		view.addObject("imageSubfix", ".png");
	}
	
	/**
	 * 响应二级菜单页面
	 * @param param
	 * @param menu
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/"+MenuConstants.LEVELTWO)
	public String levelTwo(SqlParamsBean param,Menu menu,HttpServletRequest request,RedirectAttributes redAttributes,HttpServletResponse response) {
		return "forward:../"+menu.getScode()+"/index.cnbi";
	}
}
